package com.codefish.codefishseckill.vo;

/**
 * 响应Bean工厂类
 *
 * @author codefish
 * @version 1.0
 * @date 2022/07/05 下午 02:27
 */
public class RespBeanFactory {
    public static final int SUCCESS_CODE = 200;
    public static final int ERROR_CODE = 500;
    public static final int ACCESS_DENIED_CODE = 403;
    public static final String DEFAULT_SUCCESS_MESSAGE = "操作成功";
    public static final String DEFAULT_FAIL_MESSAGE = "操作失败";
    public static final String DEFAULT_DENY_MESSAGE = "操作被拒绝";

    private RespBeanFactory() {

    }

    public static RespBean success() {
        return new RespBean(SUCCESS_CODE, DEFAULT_SUCCESS_MESSAGE, null);
    }

    public static RespBean success(String message) {
        return new RespBean(SUCCESS_CODE, message, null);
    }

    public static RespBean success(String message, Object data) {
        return new RespBean(SUCCESS_CODE, message, data);
    }

    public static RespBean fail() {
        return new RespBean(ERROR_CODE, DEFAULT_FAIL_MESSAGE, null);
    }

    public static RespBean fail(String message) {
        return new RespBean(ERROR_CODE, message, null);
    }
    public static RespBean fail(String message,Object data) {
        return new RespBean(ERROR_CODE, message, data);
    }

    public static RespBean denied() {
        return new RespBean(ACCESS_DENIED_CODE, DEFAULT_DENY_MESSAGE, null);
    }

    public static RespBean denied(String message) {
        return new RespBean(ACCESS_DENIED_CODE, message, null);
    }

}
